package com.itheima.properties02;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

public class Test {
    public static void main(String[] args) throws IOException {
        Properties pro=new Properties();

        pro.load(new FileReader("D:/code/javase_day11-homework/src/iphone.properties"));
        System.out.println(pro);
        System.out.println("----------------------");

        System.out.println(pro.getProperty("price"));
        System.out.println(pro.getProperty("brand"));
        System.out.println(pro.getProperty("capacity"));
        System.out.println("----------------------");

        Set<String> keys=pro.stringPropertyNames();
        for (String key : keys) {
            System.out.println(key+" = "+(pro.getProperty(key)));
        }
        System.out.println("----------------------");

        pro.forEach((k,v) -> {
            System.out.println(k+" = "+v);
        });

    }
}
